package at.nebbl.openscotty;

import java.util.GregorianCalendar;

/**
 *
 * @author alex.nebel
 */
public class TrainRide {

    private static final String url = "http://fahrplan.oebb.at/bin/query.exe/dn?";

    private Station startStation;
    private Station endStation;
    private GregorianCalendar date;
    private boolean departure;
    private String productList = "REQ0JourneyProduct_list=0%3A1111111111010000-000000.";
    private Route[] routes = new Route[3];

    public TrainRide(Station startStation, Station endStation){
        this.startStation = startStation;
        this.endStation = endStation;
        date = new GregorianCalendar();
        departure = true;
    }

    public TrainRide(Station startStation, Station endStation, GregorianCalendar date){
        this.startStation = startStation;
        this.endStation = endStation;
        this.date = date;
        departure = true;
    }

    public TrainRide(Station startStation, Station endStation, GregorianCalendar date, boolean departure){
        this.startStation = startStation;
        this.endStation = endStation;
        this.date = date;
        this.departure = departure;
    }

    public String getTrainRideQuery(){
        return url+"S="+startStation+"&Z="+endStation+"&start="+(departure?"1":"0")+"&time="+date.get(GregorianCalendar.HOUR_OF_DAY)+"%3A"+date.get(GregorianCalendar.MINUTE)+"&ld=oebb&REQ0JourneyDate="+date.get(GregorianCalendar.DAY_OF_MONTH)+"."+(date.get(GregorianCalendar.MONTH)+1)+"."+date.get(GregorianCalendar.YEAR)+"&"+productList;
    }

    //"http://fahrplan.oebb.at/bin/query.exe/dn?S=Wien%2FSpittelau&Z=Langenlebarn&start=1&time=12%3A00&ld=oebb&REQ0JourneyDate=25.10.2009&REQ0JourneyProduct_list=0%3A1111111111010000-000000."
}
